/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.jeu_de_dame;

import model.util.Couleur;

/**
 *
 * @author ANNAS
 */
public class FactoryPiece implements FactoryPieceIF{
    
    private static FactoryPiece instance;

    
    public static FactoryPiece getInstance()
    {
        if(FactoryPiece.instance==null)
            FactoryPiece.instance = new FactoryPiece();
        return instance;
    }
    
    private FactoryPiece()
    {
        
    }

    public Piece createPiece(FactoryPieceIF.Type type,Damier damier, Couleur couleur,int x,int y)throws Exception {
       if(type == FactoryPieceIF.Type.PION)
           return new Pion(damier, x, y, couleur);
       else if(type == FactoryPieceIF.Type.DAME)
           return new Dame(damier, x, y, couleur);
       else
           throw new Exception("Le type n'existe pas!");
    }
   
}
